package com.study.java.oop;

public class Student extends Person{
    private String name;
    @Override
    public void sayHello() {
        System.out.println("学生名字: "+name);
    }


    // 默认有无参构造函数
    public Student(){

    }


    public Student(String name) {
        this.name = name;
    }


    public void setName(String name){
        if (name.length()<3){
            System.out.println("名字不符合");
        } else {
            this.name = name;
        }
    }

    public String getName(){
        return this.name;
    }



}
